Failboxes: Provably Safe Exception Handling
نویسندگان
چکیده
The primary goal of exception mechanisms is to help ensure that when an operation fails, code that depends on the operation’s successful completion is not executed (a property we call dependency safety). However, the exception mechanisms of current mainstream programming languages make it hard to achieve dependency safety, in particular when objects manipulated inside a try block outlive the try block. Many programming languages, mechanisms and paradigms have been proposed that address this issue. However, they all depart significantly from current practice. In this paper, we propose a language mechanism called failboxes. When applied correctly, failboxes have no significant impact on the structure, the semantics, or the performance of the program, other than to eliminate the executions that violate dependency safety. Specifically, programmers may create failboxes dynamically and execute blocks of code in them. Once any such block fails, all subsequent attempts to execute code in the failbox will fail. To achieve dependency safety, programmers simply need to ensure that if an operation B depends on an operation A, then A and B are executed in the same failbox. Furthermore, failboxes help fix the unsafe interaction between locks and exceptions and they enable safe cancellation and robust resource cleanup. Finally, the Fail Fast mechanism prevents liveness issues when a thread is waiting on a failed thread. We give a formal syntax and semantics of the new constructs, and prove dependency safety. Furthermore, to show that the new constructs are easy to reason about, we propose proof rules in separation logic. The theory has been machine-checked.
منابع مشابه
Subsystems : Provably Safe Exception Handling ( Status Report ) Bart
The primary goal of exception mechanisms is to help ensure that when an operation fails, code that depends on the operation’s successful completion is not executed (a property we call dependency safety). However, current exception mechanisms make it hard to achieve dependency safety, in particular when objects manipulated inside a try block outlive the try block. To remedy this, we propose a la...
متن کاملSafe Asynchronous Exceptions for Python
We demonstrate that the Python programming language is not signal-safe, due to Python’s support for raising exceptions from signal handlers. We examine the approaches that various languages have used when dealing with the combination of asynchrony and exception handling, and propose a modification of the Python language that restores signal safety.
متن کاملException Handling for C++
This paper outlines a design for an exception handling mechanism for C++. It presents the reasoning behind the major design decisions and considers their implications for implementation alternatives. The mechanism is flexible, comparatively safe and easy to use, works in a mixed language execution environment, and can be implemented to run efficiently. Two implementation strategies are describe...
متن کاملWorst-case timing analysis of exception handling in Ada
This paper describes a method for analysing the timing properties of exception handling in Ada. The paper first describes how exceptions are implemented and considers the use of exceptions in the SPARK, Safe/Ada and ANNA subsets. A static analysis technique for reasoning about exception propagation is then presented. We argue that this technique, along with a suitable subset and detailed knowle...
متن کاملORCCAD, a framework for safe robot control design and implementation
Robotic systems are typical examples of hybrid systems where continuous time aspects, related to control laws, must be carefully merged with discrete-time aspects related to control switches and exception handling. These two aspects interact in real-time to ensure an efficient nominal behaviour of the system together with safe and graceful degradation otherwise. In a mixed synchronous/asynchron...
متن کامل